import os
import shutil
import psycopg2
import psycopg2.extras
import sys
from shapely.wkt import dumps, loads
import constant
import datetime
import glob
from osgeo import gdal

if __name__ == '__main__':

	
	#filename = "/var/www/html/fimo/apom/Resample/SatResampMYD07/*/*/*T_10km.tif"
	filename = "/home/phamha/Desktop/b/*.tif"

	for fullPath in glob.iglob(filename):
		length=len(fullPath)
		size=length-4
		new_name=fullPath[0:size]+"_mask.tif"
		print new_name
		vnshape="/home/phamha/BDNEN/VNM_adm0.shp"
		shutil.copy2(fullPath,new_name)
		os.system("gdal_rasterize -b 1 -burn 100 -l VNM_adm0 {0} {1}".format(vnshape, new_name))
		os.system("gdal_rasterize -b 1 -burn -9999 -i -l VNM_adm0 {0} {1}".format(vnshape, new_name))
		
	
